<template>
	<view :style="themeColor">
		<view class="page">
			<view class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex feedBack_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-stretch justify-between feedBack_fd0_0'>
					<view class='flex flex-wrap align-center feedBack_fd0_0_c0' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  feedBack_fd0_0_c0_c0'>&#xe794;</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<text class='feedBack_fd0_0_c1_c0'>我要反馈</text>
					</view>
					<view class='flex align-center justify-end feedBack_fd0_0_c2' @tap.stop="handleJumpDiy"
						data-type="navigateTo" :data-url="`/pages/xtsz/feedBackDetail/feedBackDetail`">
						<text class='feedBack_fd0_0_c2_c0'>反馈记录</text>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<view class="loading_css" v-if="isShow">
				<u-loading size="36" color="#E60012"></u-loading>
				<view>加载中</view>
			</view>
			<!---意见反馈表单flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout" v-else>
				<view class='flex flex-direction align-stretch feedBack_fd1_0'>
					<view class='flex flex-wrap align-center feedBack_fd1_0_c0'>
						<text class='feedBack_fd1_0_c0_c0'>反馈类型</text>
					</view>
					<view class='flex flex-direction flex-wrap align-stretch feedBack_fd1_0_c1'>
						<benben-select-diy ref="showSelectPopup1689675271268"
							class-name='flex flex-wrap align-center flex' :items.sync="dataList" v-model="changeId"
							default-type="aid" default-label="name" :allow-cancel='false' type="radio"
							:disabled='false'>
							<template v-for='(item,key0) in dataList'>
								<view v-if="item.isSelected"
									class='flex align-center justify-center flex feedBack_fd1_0_c1_c0_c0' :key="key0"
									@tap="$refs.showSelectPopup1689675271268.tapHandle(key0)">
									<text class='flex-sub feedBack_fd1_0_c1_c0_c0_c0'>{{item.title}}</text>
								</view>
								<view v-else class='flex align-center justify-center flex feedBack_fd1_0_c1_c0_c1'
									:key="key0" @tap="$refs.showSelectPopup1689675271268.tapHandle(key0)">
									<text class='flex-sub feedBack_fd1_0_c1_c0_c1_c0'>{{item.title}}</text>
								</view>
							</template></benben-select-diy>
					</view>
					<text class='feedBack_fd1_0_c2'>问题描述</text>
					<view class='flex flex-direction flex-wrap align-stretch feedBack_fd1_0_c3'>
						<view class='flex flex-wrap feedBack_fd1_0_c3_c0'>
							<textarea class='flex feedBack_input_fd1_0_c3_c0' confirm-type="done"
								:placeholder="'问题描述的越详细，有助于我们更快的解决问题'" :maxlength="300" :show-num='true'
								placeholder-style="color:#999;font-size:28rpx" v-model="body" />
							<template>
								<view class='flex flex justify-end feedBack_numberfd1_0_c3_c0_c0'>
									<text>{{body.length}}</text>
									<text>/</text>
									<text>300</text>
								</view>
							</template>
						</view>
					</view>
					<view class='flex flex-direction flex-wrap align-stretch'>
						<benben-images-upload ref="benbenImagesUploadfd1_0_c4_c0" :img-list.sync="img"
							:img-ids.sync="img_id" :is-show-tips='true' :maxlength="6">
							<template #content="{ num, maxlength, isShow, imgList }">
								<view class="flex flex-wrap align-start flex feedBack_fd1_0_c4_c0">

									<view v-for="(image, index) in imgList" :key="index"
										class='flex position-relative feedBack_fd1_0_c4_c00'>
										<text class='fu-iconfont2 position-absolute feedBack_fd1_0_c4_c000'
											@tap.stop="$refs.benbenImagesUploadfd1_0_c4_c0.delImage(index)">&#xE8E7;</text>
										<image class='feedBack_fd1_0_c4_c001'
											@tap.stop="$refs.benbenImagesUploadfd1_0_c4_c0.previewImage(index)"
											mode="aspectFill" :src='image'></image>
									</view>

									<image class='feedBack_fd1_0_c4_c01'
										@tap.stop="$refs.benbenImagesUploadfd1_0_c4_c0.manyChooseImage()" v-if="isShow"
										mode="aspectFill" :src='STATIC_URL+"77.png"'></image>
									<text
										class='image_upload_tips feedBack_fd1_0_c4_c02'>请上传应用截图，最多上传{{maxlength}}张</text>
								</view>
							</template>
						</benben-images-upload>
					</view>
				</view>
				<button class='flex-sub feedBack_fd1_1' @tap.stop="postfeedbackFunc()">提交反馈</button>
			</view>

			<!---意见反馈表单flex布局结束-->


		</view>
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				"changeId": "1",
				"changeType": [{
					"name": "下载/加载问题",
					"value": "1",
					"image": ""
				}, {
					"name": "会员付费问题",
					"value": "2",
					"image": ""
				}, {
					"name": "章节/图片问题",
					"value": "3",
					"image": ""
				}, {
					"name": "APP体验问题",
					"value": "4",
					"image": ""
				}, {
					"name": "卡顿/不流畅",
					"value": "5",
					"image": ""
				}, {
					"name": "其他",
					"value": "6",
					"image": ""
				}],
				"dataList": [],
				"body": "",
				"img": [],
				"img_id": "",
				"isShow": true,
				"is_submit": false,
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			this.getTypeFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//提交反馈
			async postfeedbackFunc() {
				if (this.is_submit) return;
				if (!validate(this.changeId, 'require')) {
					this.$message.info('请选择反馈类型');
					return false;
				}
				if (!validate(this.body, 'require')) {
					this.$message.info('请输入问题描述');
					return false;
				}
				//请求方法
				//数据验证
				this.is_submit = true;
				let data6414724b96f3f = await this.$api.dbPost(global.apiUrls.post6414724b96f3f, {
					type_id: this.changeId,
					body: this.body,
					thumb: this.img.length > 0 ? this.img.join(',') : ""
				});
				if (data6414724b96f3f.data.code != 1) {
					this.is_submit = false;
					this.$message.info(data6414724b96f3f.data.msg);
					return
				}
				this.$message.info(data6414724b96f3f.data.msg);
				setTimeout(() => {
					this.is_submit = false;
					this.$urouter.redirectTo(`/pages/xtsz/feedBackDetail/feedBackDetail`);
				}, 800)
				
			},
			//获取反馈类型
			async getTypeFunc() {
				//请求方法
				//数据验证

				let datadataList = await this.$api.post(global.apiUrls.post6414719bdc956, {
					user_type: '1'
				});
				this.isShow = false;
				if (datadataList.data.code != 1) {
					this.$message.info(datadataList.data.msg);
					return
				}
				let infodataList = datadataList.data;
				this.dataList = infodataList.data

				this.changeId = this.dataList[0].aid //默认类型id
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #f6f7f9;
		background-size: 100% auto;
	}

	.feedBack_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.feedBack_fd0_0_c2_c0 {
		font-size: 28rpx;
		font-weight: 500;
		color: var(--benbenFontColor0);
	}

	.feedBack_fd0_0_c2 {
		padding: 0rpx 0rpx 0rpx 0rpx;
		width: 200rpx;
	}

	.feedBack_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: var(--benbenFontColor0);
		line-height: 50rpx;
	}

	.feedBack_fd0_0_c0_c0 {
		font-size: 36rpx;
		font-weight: 400;
		color: #333;
	}

	.feedBack_fd0_0_c0 {
		width: 200rpx;
	}

	.feedBack_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.feedBack_fd1_1 {
		background: #E60012;
		font-size: 32rpx;
		color: var(--benbenFontColor3);
		height: 80rpx;
		line-height: 80rpx;
		width: 678rpx;
		position: fixed;
		left: 36rpx;
		bottom: calc(40rpx + var(--window-bottom));
		border-radius: 16rpx;
	}

	.feedBack_fd1_0_c4_c02 {
		font-size: 24rpx;
		color: var(--benbenFontColor2);
		font-weight: 400;
		width: 100%;
	}

	.feedBack_fd1_0_c4_c01 {
		width: 160rpx;
		height: 160rpx;
		margin: 0rpx 24rpx 24rpx 0rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.feedBack_fd1_0_c4_c001 {
		width: 160rpx;
		height: 160rpx;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}

	.feedBack_fd1_0_c4_c000 {
		top: 0rpx;
		right: 0rpx;
		z-index: 10;
		color: #ff5536;
	}

	.feedBack_fd1_0_c4_c00 {
		margin: 0rpx 24rpx 24rpx 0rpx;
	}

	.feedBack_fd1_0_c4_c0 {
		padding: 0rpx 36rpx 0rpx 36rpx;
	}

	.feedBack_numberfd1_0_c3_c0_c0 {
		width: 100%;
		font-size: 24rpx;
		color: rgba(153, 153, 153, 1);
		line-height: 46rpx;
		font-weight: 400;
	}

	.feedBack_input_fd1_0_c3_c0 {
		width: 100%;
		height: 424rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: var(--benbenFontColor0);
		padding: 24rpx 24rpx 24rpx 24rpx;
	}

	.feedBack_fd1_0_c3_c0 {
		background: #f6f7f9;
		width: 678rpx;
		border-radius: 10rpx 10rpx 10rpx 10rpx;
		margin: 0 36rpx;
		padding: 0rpx 0rpx 24rpx 0rpx;
		background-size: 100% auto;
	}

	.feedBack_fd1_0_c3 {
		margin: 0rpx 0rpx 32rpx 0rpx;
	}

	.feedBack_fd1_0_c2 {
		font-size: 32rpx;
		font-weight: 500;
		color: var(--benbenFontColor0);
		line-height: 109rpx;
		margin: 0rpx 36rpx 0rpx 36rpx;
	}

	.feedBack_fd1_0_c1_c0_c1_c0 {
		font-size: 28rpx;
		font-weight: 400;
		color: var(--benbenFontColor0);
		line-height: 62rpx;
		text-align: center;
	}

	.feedBack_fd1_0_c1_c0_c1 {
		background: #F6F7F9;
		margin: 16rpx 16rpx 16rpx 16rpx;
		height: 64rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		padding: 0rpx 36rpx 0rpx 36rpx;
	}

	.feedBack_fd1_0_c1_c0_c0_c0 {
		font-size: 28rpx;
		font-weight: 400;
		color: rgba(230, 0, 18, 1);
		line-height: 62rpx;
		text-align: center;
	}

	.feedBack_fd1_0_c1_c0_c0 {
		background: #FEF2F2;
		margin: 16rpx 16rpx 16rpx 16rpx;
		height: 64rpx;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		padding: 0rpx 36rpx 0rpx 36rpx;
		color: rgba(230, 0, 18, 1);
	}

	.feedBack_fd1_0_c1 {
		border-bottom: 10px solid rgba(246, 247, 248, 1);
		padding: 0rpx 24rpx 16rpx 24rpx;
	}

	.feedBack_fd1_0_c0_c0 {
		font-size: 32rpx;
		font-weight: 500;
		color: var(--benbenFontColor0);
		margin: 0rpx 36rpx 0rpx 36rpx;
	}

	.feedBack_fd1_0_c0 {
		padding: 32rpx 0rpx 12rpx 0rpx;
	}

	.feedBack_fd1_0 {
		background: var(--benbenbgColor1);
		background-size: 100% auto !important;
		margin: 0rpx 0rpx 180rpx 0rpx;
		padding: 0rpx 0rpx 48rpx 0rpx;
	}
</style>